Skip to content

Forward euler implementation in Common Lisp #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 24, 2020

Conversation

Trashtalk217
Copy link
Contributor

A review is appreciated!

@june128 june128 added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jun 5, 2019
@berquist berquist self-assigned this Oct 6, 2019
Copy link
Member

@berquist berquist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just minor indentation stuff.

(loop
with result = (make-array n :initial-element 1)
for i from 1 upto (1- n) do
(setf (svref result i) (- (svref result (1- i)) (* 3 (svref result (1- i)) timestep)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be indented.

with approximatep = t
with solution = 0
for i from 0 upto (1- (length result)) do
(setf solution (exp (* (- 3) i timestep)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar indentation question here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @berquist, what is wrong with the indentation exactly? How many spaces should (setf ... be indented with?

Copy link
Contributor Author

@Trashtalk217 Trashtalk217 May 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I should learn to read. I disagree that it shouldn't be indented, because do introduces a code block, that reads different to the loop syntax

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're getting indentation within the do section and I am not. When I use emacs -Q to remove all my customizations, the entire loop body is unindented.

In addition a very loose style guide (https://lisp-lang.org/style-guide/) plus reading somewhere else that it doesn't really matter that much, these are nitpicks that can be ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pressed tab on the code and found that it unindented the code. I apparently made the decision half a year ago that this would be easier to read. I don't really care that much now and it should still be fine, so I'll put the code back.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, leave it as is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well now I've changed it.

This is stupid, just merge it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2wd65n

Copy link
Member

@berquist berquist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my previous nits, everything looks good and works properly.

@berquist berquist merged commit fb14e81 into algorithm-archivists:master May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants